from multiprocessing import Process, Queue

q = Queue()


def sum_func(q, start, end):
    my_sum = 0
    for i in range(start, end):
        my_sum += i
    q.put(my_sum)
    print("Start:", start)


def run_process():
    p1 = Process(target=sum_func, args=(q, 1, 5000000))
    p2 = Process(target=sum_func, args=(q, 5000000, 10000000))
    p1.start()
    p2.start()
    p1.join()
    p2.join()

    my_sum = 0
    while not q.empty():
        my_sum += q.get()

    print(my_sum)


if __name__ == "__main__":
    run_process()
